<template>
    <div>
        <h2>子组件</h2>
        {{message}}
        <button v-on:click="sendMsgToparent">向父组件传值</button>
        <div v-on:click="rouPageonequery">事件query传值</div>
    </div>
</template>

<script>
export default {
  data () {
    return {

    }
  },
  name: 'Child',
  props: ['message'],
  methods: {
    sendMsgToparent: function () {
      this.$emit('listenToChildEvent', 'this message is from child')
    },
    rouPageonequery: function () {
      // this.$router.push({path: '/pageone', query: {name: 'lvjian'}})
      this.$router.push({path: '/pageone', params: {name: 'lvjian'}})
    }
  },
  mounted () {
    console.log(this.$props.message)

    //   this.$route.params.
  }
}
</script>

<style scoped>
div{
  background-color: red;
}

</style>
